<?php
include ("includes/header.php");
include ("includes/connection.php");
include ("includes/login.php");
include ("includes/iniciaSessio.php");
?>

<body >
        <?php
        include ("includes/contentHeader.php");
        include ("./includes/menuMissatges.php");
        // Buscamos los mensajes privados
$sql = "SELECT * FROM missatge WHERE per='" . $_SESSION['username'] . "' order by idMissatge";
$res = mysql_query($sql, $conexion) or die(mysql_error());
        ?>
        <!--contingut 1-->
        <section class="container">
                <!--fons gris-->
                <div class="hero-unit">
                        <table width="800" border="0" align="center" cellpadding="1" cellspacing="1">
                                <tr>
                                        <td width="426" align="center" valign="top"><strong>De</strong></td>
                                        <td width="321" align="center" valign="top"><strong>Assumpte</strong></td>
                                        <td width="321" align="center" valign="top"><strong>Data</strong></td>
                                </tr>
                                <?php
$i = 0;
while($row = mysql_fetch_assoc($res)){
                                ?>
                                <tr bgcolor="<?php
                                if ($row['llegit'] == 1) {
                                        echo "#10E12C";
                                }
                                if ($row['llegit'] == 0) {
                                        echo "#FA4F4C";
                                }
                                ?>">
                                        <td align="center" valign="top"><a href="leer.php?id=<?=$row['idMissatge'] ?>"><?=$row['de']
                                        ?></a></td>
                                        <td align="center" valign="top"><?=$row['assumpte']
                                        ?></td>
                                        <td align="center" valign="top"><?=$row['data']
                                        ?></td>
                                </tr>
                                <?php $i++;
                                        }
                                ?>
                        </table>
                </div>
                <!-- fi fons gris-->
        </section>
        <!-- fi contingut 1-->
        <!--contingut 2-->
        <section class="container">
                <div class="hero-unit"></div>
        </section>
        <!-- fi contingut 2-->
        <hr>
        <?php
        include ("includes/footer.php");
        ?>


